<?php include('../variables/variables.php'); ?>

<?php

$con = mysql_connect($dbserver, $dbuser, $dbpass);
if ($con)
{
	mysql_select_db($db, $con);
	
	//$book_renewal_limit
	
	$q = fquery($book_renewal_limit, array($_GET['id']));
	$result = mysql_fetch_array(mysql_query($q));
	
	if ($result['renewal_count'] >= $result['renewal_limit'])
	{
		mysql_close($con);
		header("location: /profile.php?err=Renewal limit reached!");
	}
	else
	{
		$q = fquery($renew_book, array($_GET['id']));
		mysql_query($q);
		mysql_close($con);
		header("location: /profile.php");
	}
}

?>
